import request from '@/utils/request';

// 服务列表
export async function serviceList(data) {
  const res = await request.post('/serviceList', data);
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 订单列表

export async function serviceOrder(data) {
  const res = await request.post('/serviceOrder', data);
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 拒绝订单
export async function refuseServiceOrder(data) {
  const res = await request.post('/refuseServiceOrder', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 结束订单
export async function settlementService(data) {
  const res = await request.post('/settlementService', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 服务上下架

export async function upServiceStatus(data) {
  const res = await request.post('/upServiceStatus', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// /
export async function serviceTopList(data) {
  const res = await request.post('/serviceTopList', data);
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 一键退单
export async function refuseAllOrder(data) {
  const res = await request.post('/refuseAllOrder', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}
